home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / fortran / toolpack.000 / toolpack / toolpack1.2 / scriptsource / fdiff.s < prev    next >
Encoding:
Text File  |  1993-10-04  |  3.8 KB  |  128 lines

  1. #! /bin/csh
  2. #  fdiff is a csh script to compare the token and comment streams of
  3. #  two Fortran programs using ISTFD.  If the optional third argument
  4. #  is "nc", then only the token streams are compared.
  5. #
  6. #
  7. #  Invocation:
  8. #
  9. #  fdiff Fortran_source_file_1 Fortran_source_file_2 [nc]
  10. #
  11. #  Check command line validity.
  12. if ( $#argv < 2 ) then
  13. TOOLPACKPATH/toolpack1.2/util/echoerr \
  14. Invocation:
  15. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  16. TOOLPACKPATH/toolpack1.2/util/echoerr \
  17. "fdiff Fortran_source_file_1 Fortran_source_file_2 [nc]"
  18. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  19. TOOLPACKPATH/toolpack1.2/util/echoerr \
  20. 'If the optional third argument is "nc", comment differences are ignored.'
  21. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  22. TOOLPACKPATH/toolpack1.2/util/echoerr \
  23. A report is sent to standard output and may be redirected to a file.
  24. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  25.    exit
  26. endif
  27. #  Check that Fortran_source_file_1 exists.
  28. if ( -e $1 == 0 ) then
  29. TOOLPACKPATH/toolpack1.2/util/echoerr \
  30. "'$1' does not exist."
  31.    exit
  32. endif
  33. #  Check that Fortran_source_file_2 exists.
  34. if ( -e $2 == 0 ) then
  35. TOOLPACKPATH/toolpack1.2/util/echoerr \
  36. "'$2' does not exist."
  37.    exit
  38. endif
  39. #
  40. #  Create PFS.  If PFS already exists, exit with an advisory message.
  41. #
  42. if ( -e _.TOOLPACK == 0 ) then
  43.    mkdir _.TOOLPACK
  44. else
  45. TOOLPACKPATH/toolpack1.2/util/echoerr \
  46. Toolpack-created directory '"_.TOOLPACK"' exists. \
  47. Remove with script '"discard"'.
  48.    exit
  49. endif
  50. #  Make a tab-free, upper case copy of Fortran_source_file_1 for lexing.
  51. set src1 = src1
  52. expand $1 | tr a-z A-Z > _.TOOLPACK/$src1
  53. #  Lexer token stream file name for Fortran_source_file_1.
  54. set tkn1 = tkn1
  55. #  Lexer comment file name for Fortran_source_file_1.
  56. set cmt1 = cmt1
  57. #  Create the interprocess file IST.CMD and append parameters for ISTLX.
  58. TOOLPACKPATH/toolpack1.2/util/mkipf \
  59. $src1 - $tkn1 $cmt1
  60. #
  61. #  Invoke ISTLX.
  62. #
  63. TOOLPACKPATH/toolpack1.2/exec/istlx.u
  64. #
  65. #  If lexer errors are reported, advise user to obtain listing.
  66. if ( `cat _.TOOLPACK/_.info` == -1 ) then
  67. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  68. TOOLPACKPATH/toolpack1.2/util/echoerr \
  69. 'First program has lexical scanning errors.  Invoke script "getlst"'
  70. TOOLPACKPATH/toolpack1.2/util/echoerr \
  71. to obtain a listing showing statement and token numbers.
  72. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  73.    set prog1lex = error
  74. else
  75.    set prog1lex = ok
  76. endif
  77. #  Make a tab-free, upper case copy of Fortran_source_file_2 for lexing.
  78. set src2 = src2
  79. expand $2 | tr a-z A-Z > _.TOOLPACK/$src2
  80. #  Lexer token stream file name for Fortran_source_file_2.
  81. set tkn2 = tkn2
  82. #  Lexer comment file name for Fortran_source_file_2.
  83. set cmt2 = cmt2
  84. #  Create the interprocess file IST.CMD and append parameters for ISTLX.
  85. TOOLPACKPATH/toolpack1.2/util/mkipf \
  86. $src2 - $tkn2 $cmt2
  87. #
  88. #  Invoke ISTLX.
  89. #
  90. TOOLPACKPATH/toolpack1.2/exec/istlx.u
  91. #
  92. #  If lexer errors are reported, advise user to obtain listing.
  93. if ( `cat _.TOOLPACK/_.info` == -1 ) then
  94. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  95. TOOLPACKPATH/toolpack1.2/util/echoerr \
  96. 'Second program has lexical scanning errors.  Invoke script "getlst"'
  97. TOOLPACKPATH/toolpack1.2/util/echoerr \
  98. to obtain a listing showing statement and token numbers.
  99. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  100.    set prog2lex = error
  101. else
  102.    set prog2lex = ok
  103. endif
  104. #
  105. #  If both programs lexed without error, prepare for differencing.
  106. #
  107. if ( $prog1lex == ok && $prog2lex == ok ) then
  108. #  Create the interprocess file IST.CMD and append parameters for ISTFD.
  109.    if ( $3 == nc ) then
  110. TOOLPACKPATH/toolpack1.2/util/mkipf \
  111. $tkn1 $cmt1 $tkn2 $cmt2 \#1 'mode=statement'
  112.    else
  113. TOOLPACKPATH/toolpack1.2/util/mkipf \
  114. $tkn1 $cmt1 $tkn2 $cmt2 \#1 'mode=statement comment_check=yes'
  115.    endif
  116. #
  117. #  Invoke ISTFD.
  118. #
  119. TOOLPACKPATH/toolpack1.2/exec/istfd.u
  120. #
  121. else
  122. #  One or both programs had lexing errors.
  123. endif
  124. #
  125. /bin/rm -r _.TOOLPACK
  126. #
  127.  
  128.